$(function () {
    var token = $("#token").val();
    if(isempty(token)) {
        location.href = "/except/login.jsp";
        return;
    } else {
        var jsonstr = "{token:" + token + "}";
        var url = "/except/usercontroller/getmyspare.action";
        $.ajax({
            url: url,
            type: 'post',
            dataType: "json",
            data: {
                "json": jsonstr,
            },
            async: false,
            success: function (data) {
                var code = data.code;
                var message = data.message;
                if (code == 20000) {
                    $("#sparemoney").html(data.data.sparemoney);
                    remove_advertising()
                } else if (code == 10001 || code == 10002) {
                    location.href = "/except/login.jsp";
                } else {
                    $("#hintbg").show();
                    $("#hint_message").html(message);
                }
            }
        });
    }
});